/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: jse2204 - Exception1
 * <p>Powered by webrx On 2022-09-16 10:54:15
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Exception1 {
    public static void main(String[] args) {
        //int I = 100;
        //System.out.println(I);

        //try块感觉有异常的语句代码块
        //catch块是有异常时要执行的代码
        //finally 有没有异常必须要执行的块代码
        //throw用于有try catch块代码中，用来抛出一个异常
        //thorws 用方法声明处，抛出多个异常
        int[] n = new int[]{1, 3, 4, 5};
        try {
            System.out.println("one");
            System.out.println(n[n.length - 2]);
            System.out.println("two");
        } catch (Exception e) {
            System.out.println("有异常，异常信息如下：");
            e.printStackTrace();
        } finally {
            System.out.println("有没有异常都要执行");
        }
        System.out.println("程序结果");

    }
}
